#include <gtest/gtest.h>
#include <iostream>
#include <unordered_map>

class EnvironmentTest : public testing::Environment
{
public:
    virtual void SetUp() override
    {
        std::cout << "EnvironmentTest数据的初始化..." << std::endl;
    }
    virtual void TearDown() override
    {
        std::cout << "EnvironmentTest数据清理..." << std::endl;
    }
};
TEST(EnvironmentTest, test1)
{
    std::cout << "test1..." << std::endl;
}
TEST(EnvironmentTest, test2)
{
    std::cout << "test2..." << std::endl;
}

std::unordered_map<int, int> dict;
class DictTest : public testing::Environment
{
public:
    virtual void SetUp() override
    {
        std::cout << "DictTest数据的初始化..." << std::endl;
        dict[1] = 1;
        dict[2] = 2;
    }
        virtual void TearDown() override
    {
        std::cout << "DictTest数据清理..." << std::endl;
        dict.clear();
    }
};
TEST(DictTest, test1)
{
    std::cout << "test1..." << std::endl;
    EXPECT_EQ(dict.size(), 2);
    dict.erase(1);
}
TEST(DictTest, test2)
{
    std::cout << "test2..." << std::endl;
    EXPECT_EQ(dict.size(), 2);
}
int main(int argc, char* argv[])
{
    testing::InitGoogleTest(&argc, argv);
    testing::AddGlobalTestEnvironment(new EnvironmentTest);
    testing::AddGlobalTestEnvironment(new DictTest);

    return RUN_ALL_TESTS();
}

